<script type="text/javascript">
	function load_er(on){
			if(on){

				$('#btn_add').button('loading');
			}else{

				$('#btn_add').button('reset');
			}
		
		}
	
		

		
</script>

<div class="modal fade" id="addFolderModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog" id="e">
		
		<div class="modal-content">
			
			<div class="modal-header">
        		<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        		<h4 class="modal-title" id="myModalLabel">Aggiungi una Cartella</h4>
      		</div>
      		
      		<div class="modal-body">
        		
        		<g:hasErrors bean="${docTypeInstance}">
		<div class="alert alert-danger">
			<g:renderErrors bean="${docTypeInstance}" as="list" />
		</div>
	</g:hasErrors>

		<g:form controller="docType" action="save" class="form-horizontal" role="form" >
			
			<div style="display:none" id="failureAdd" class="row">
				<p id="failureAddText" class="alert alert-info">
					
				</p>
			
			</div>
			
			<div class="${hasErrors(bean: docTypeInstance, field: 'documentType', 'error')} ">
				<label for="documentType" class="control-label"><g:message code="docType.documentType.label" default="Nome Cartella" /></label>
				<div>
					<g:textField id="docTypeTxt" class="form-control" name="documentType" value="${docTypeInstance?.documentType}"/>
					<span class="help-inline">${hasErrors(bean: docTypeInstance, field: 'documentType', 'error')}</span>
				</div>
			</div>
			

			<div class="form-actions margin-top-medium">
			
				<g:submitToRemote 
					id="btn_add" 
					data-loading-text="Loading..." 
					url="[action:'addFolder',controller:'DocType']" 
					update="[success:'folder_tree',failure:'failureAddText']"  
					class="btn btn-primary" 
					value="${message(code: 'default.button.create.label', default: 'Create')}" 
					onFailure="failAdd()"
					onSuccess="successAdd('Cartella creata con successo');"
					data-dismiss="modal"
				/>
	           
			</div>
		</g:form>



</div>
        	
        		
      		</div>
		
		
		</div>
	
	</div>
	

</div>